// @ts-ignore
/* eslint-disable */
import { request } from "@umijs/max";

/** 获取当前登录用户 GET /user/current */
export async function getCurrentUser(options?: { [key: string]: any }) {
  return request<API.ResultUserDto>("/user/current", {
    method: "GET",
    ...(options || {}),
  });
}

/** 查询所有用户信息 POST /user/list */
export async function list(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listParams,
  options?: { [key: string]: any }
) {
  return request<API.ResultListUserDto>("/user/list", {
    method: "POST",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** login 登录 POST /user/login */
export async function login(
  body: API.LoginQuery,
  options?: { [key: string]: any }
) {
  return request<API.ResultUserDto>("/user/login", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** logout 注销 POST /user/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<API.ResultBoolean>("/user/logout", {
    method: "POST",
    ...(options || {}),
  });
}
